package continuity;

/**
 * Zetor csapat szekelton
 * 
 * A program célja hogy a modellről eldönthető legyen, hogy a feladat egy helyes
 * megoldását nyújtja.
 * 
 * @author Balogh Peter Tamas
 * @author Gál István László
 * @author Kárász Gábor
 * @author Simon Endre András
 * @author Szabó Alex
 */
public class Level {

    private int id;
    private LevelItem[][] levelitems;
    private LevelItem activelevelitem;
    private int EmptyItemPos_x;
    private int EmptyItemPos_y;
    private Character character;
    private Game game;
    /**
     * 
     */
    static public String className = "Level";
    /**
     * 
     */
    public String name;

    /**
     * 
     * @param n
     */
    public Level(String n) {
        name = n;
    }

    public Level(Game g, String n) {
        name = n;
        game = g;
    }

    /**
     * 
     */
    public void getID() {
    }

    /**
     * 
     * @param dir
     */
    public void moveEmptyItem(int dir) {
    }

    /**
     * 
     */
    public void getActiveItem() {
        String classInfo = name + "(" + className + ")::setActiveItem(): void";
        Continuity.methodEntry(classInfo);
        Continuity.methodExit(classInfo);
        Continuity.methodVoid();
    }

    /**
     * 
     * @param i
     */
    public void setActiveItem(LevelItem i) {
        String classInfo = name + "(" + className + ")::setActiveItem(LevelItem i): void";
        Continuity.methodEntry(classInfo);
        Continuity.methodExit(classInfo);
        Continuity.methodVoid();
        activelevelitem = i;
    }

    /**
     * 
     * @param c
     */
    public void addCharacter(Character c) {
        String classInfo = name + "(" + className + ")::addCharachter(Character c): void";
        Continuity.methodEntry(classInfo);
        Continuity.methodExit(classInfo);
        Continuity.methodVoid();
        character = c;
    }

    /**
     * 
     * @param l
     */
    public void addLevelItem(LevelItem l) {
        String classInfo = name + "(" + className + ")::addLevelItem(): void";
        Continuity.methodEntry(classInfo);
        Continuity.methodExit(classInfo);
        Continuity.methodVoid();
    }

    /**
     * 
     */
    public void Tick() {
        String classInfo = name + "(" + className + ")::Tick(): void";
        Continuity.methodEntry(classInfo);

        Continuity.Loop("LevelItemekre Tick hivas");
        activelevelitem = new LevelItem("ActiveItem");
        Continuity.methodCall(className, name, activelevelitem.className, activelevelitem.name, "Tick(): void");
        activelevelitem.Tick();
        Continuity.LoopEnd();
        Continuity.methodExit(classInfo);
        Continuity.methodVoid();
    }

    void startTest2() {
        Continuity.methodCall(className, name, Game.className, game.name, "getView(): int");
        int view = game.getView();

        Continuity.methodCall(character.className, character.name, className, name, "moveCharacter(int dir): void");
        if (view == 1) {
            Continuity.Alt("Palya nezet");
            Continuity.methodCall(className, name, character.className, character.name, "setCanMove(false): void");
            Continuity.AltEnd();
        } else {
            Continuity.Alt("Palyaelem nezet");
            Continuity.methodCall(className, name, activelevelitem.className, activelevelitem.name, "intersectAll(character): void");
            Continuity.Loop("Osszes sprite vizsgalata");
            activelevelitem.intersectAll(character, 2);
            Continuity.methodCall(className, name, character.className, character.name, "setCanMove(coll): void");
            Continuity.AltEnd();
            Continuity.LoopEnd();
        }
        Continuity.methodVoid();

    }
}
